package com.weiaibenpao.demo.chislim.ui.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.weiaibenpao.demo.chislim.R;
import com.weiaibenpao.demo.chislim.bean.Moment;
import com.weiaibenpao.demo.chislim.ui.widget.MomentView;

/**
 * Created by Administrator on 2018/1/3.
 */

public class MomentListAdapter extends BaseQuickAdapter<Moment,BaseViewHolder> {

    public MomentListAdapter() {
        super(R.layout.item_moment, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, Moment moment) {
      MomentView momentView = baseViewHolder.getView(R.id.momentView);
      momentView.setApplyType(MomentView.TYPE_MOMENT_LIST);
      if(getHeaderLayoutCount() == 1){
          momentView.setView(moment,baseViewHolder.getAdapterPosition()-1);
      }else {
          momentView.setView(moment,baseViewHolder.getAdapterPosition());
      }
      baseViewHolder.addOnClickListener(R.id.more);
      baseViewHolder.addOnClickListener(R.id.like_container);
    }
}
